/**
 * @date 2:52:05 PM
 * EducationPathServiceImpl.java
 * Administrator
 * TODO
 */
package com.qs.education.bean.service.impl;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.qs.education.bean.entity.EducationPath;
import com.qs.education.bean.service.BaseService;
import com.qs.education.bean.service.IEducationPahtService;

/**
 * @class EducationPathServiceImpl
 * @author Brooks
 * @description 
 * @date Oct 24, 2018
 */
@Service
public class EducationPathServiceImpl extends BaseService implements IEducationPahtService{

	/**
	 * @description 得到访问api的路径,如果有缓存则从缓存中直接读取
	 * @user Brooks
	 * @date Oct 17, 2018
	 * @return EducationAdmin
	 */
	@Cacheable(value = "api_path")
	public String getEducationPath() {
		String configuredUrl = "";
		EducationPath educationPath = iEducationPathDao.getEducationPath();
		if(educationPath == null || educationPath.getPath().isEmpty()){
			throw new RuntimeException("API host url is not configured.");
		} 
		configuredUrl = educationPath.getPath();
		if(!configuredUrl.endsWith("/")){
			configuredUrl = configuredUrl + "/";
		}
		//configuredUrl = configuredUrl + "education-api/";
		return configuredUrl;
	}

}
